import React from 'react';
import { connect } from 'dva'                         //看源码dva仅转包装输出，没做修改
import { Redirect,routerRedux } from 'dva/router';     //dva/router在react router上添加routerRedux
import BasicLayout from './../layouts/BasicLayout'

const Authorization=(props)=>{
	const {user}=props;
	if(user && user.name && user.name==="admin"){       
        return <Redirect from="*" to="/home/index" />
	}else{
		return <Redirect from="*" to="/login" />
	}
}

export default connect((state)=>{
	return {
		user:state.app.user       //app是model命名空间，user是app.state.user
	}
})(Authorization)
